package cn.edu.jxau.core.web;

/**
 * Desc: 封装http request信息
 * ------------------------------------
 * Author:fulei04@meituan.com
 * Date:2017/12/17
 * Time:下午2:11
 */
public class Request {

    /**
     * 请求url路径
     */
    private String requestURL;

    /**
     * 请求方法,如GET、POST、DELETE等
     */
    private String requestMethod;

    public Request(String requestMethod,String requestURL) {

        this.requestMethod = requestMethod;
        this.requestURL = requestURL;
    }

    @Override
    public boolean equals(Object obj) {

        if(!(obj instanceof Request)) {
            return false;
        }
        Request request = (Request)obj;
        if(request.getRequestURL().equals(this.requestURL)
                && request.getRequestMethod().equalsIgnoreCase(this.requestMethod)) {
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return (requestURL+requestMethod).hashCode();
    }


    public String getRequestURL() {
        return requestURL;
    }

    public String getRequestMethod() {
        return requestMethod;
    }
}
